
enum BAUD_RATE {
    //% block="9600"
    9600,
    //% block="115200"
    115200
}


//% color="#30C08D" iconWidth=50 iconHeight=40
namespace ASRPRO {
    //% block="初始化语音识别模块波特率 [BAUD] 管脚[RXPIN]" blockType="command"
    //% RXPIN.shadow="dropdown" RXPIN.options="RXPIN"
    //% BAUD.shadow="dropdown" BAUD.options="BAUD_RATE"
    export function asrSetup(parameter: any, block: any) {
        let RXPIN = parameter.RXPIN.code;
         let BAUD = parameter.BAUD.code;
        Generator.addSetup("Serial1Setup",`Serial1.begin(${BAUD} ,${RXPIN},-1);`);
    }

    //% block="有语音可读?" blockType="boolean"
    export function available() {
        Generator.addCode(`Serial1.available()`)
    }

    //% block="读取语音模块内容" blockType="reporter"
    export function readAasrNum() {
        Generator.addCode(`Serial1.read()`)
    }
   
}
